package com.nbsaas.boot.order.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "订单退款", model = "订单退款")
@Entity
@Table(name = "bs_order_refund")
@Comment("订单退款表")
public class OrderRefund extends AbstractEntity {

    @Comment("订单ID")
    @FormField(title = "订单ID", sortNum = "1", grid = true, required = true)
    @Column(name = "order_id", nullable = false)
    private Long orderId;

    @Comment("订单编号")
    @FormField(title = "订单编号", sortNum = "2", grid = true, required = true)
    @Column(name = "order_no", nullable = false, length = 64)
    private String orderNo;

    @Comment("退款单号")
    @FormField(title = "退款单号", sortNum = "3", grid = true, required = true)
    @Column(name = "refund_no", nullable = false, unique = true, length = 64)
    private String refundNo;

    @Comment("退款类型")
    @FormField(title = "退款类型", sortNum = "4", grid = true, type = InputType.select)
    @Column(name = "refund_type", nullable = false)
    private Integer refundType;

    @Comment("退款原因")
    @FormField(title = "退款原因", sortNum = "5", grid = true, type = InputType.select)
    @Column(name = "refund_reason", nullable = false)
    private Integer refundReason;

    @Comment("退款详细原因")
    @FormField(title = "退款详细原因", sortNum = "6", type = InputType.textarea)
    @Column(name = "refund_detail", length = 500)
    private String refundDetail;

    @Comment("退款金额")
    @FormField(title = "退款金额", sortNum = "7", grid = true, type = InputType.el_input_number)
    @Column(name = "refund_amount", nullable = false, precision = 10, scale = 2)
    private BigDecimal refundAmount;

    @Comment("退款状态")
    @FormField(title = "退款状态", sortNum = "8", grid = true, type = InputType.select)
    @Column(name = "refund_status", nullable = false)
    private Integer refundStatus = 0;

    @Comment("申请退款时间")
    @FormField(title = "申请退款时间", sortNum = "9", type = InputType.date, grid = true, required = true)
    @Column(name = "apply_time", nullable = false)
    private LocalDateTime applyTime;

    @Comment("审核时间")
    @FormField(title = "审核时间", sortNum = "10", type = InputType.date, grid = true)
    @Column(name = "audit_time")
    private LocalDateTime auditTime;

    @Comment("审核人ID")
    @FormField(title = "审核人ID", sortNum = "11", grid = true)
    @Column(name = "auditor_id")
    private Long auditorId;

    @Comment("审核人姓名")
    @FormField(title = "审核人姓名", sortNum = "12", grid = true)
    @Column(name = "auditor_name", length = 50)
    private String auditorName;

    @Comment("审核备注")
    @FormField(title = "审核备注", sortNum = "13", type = InputType.textarea)
    @Column(name = "audit_remark", length = 200)
    private String auditRemark;

    @Comment("退款时间")
    @FormField(title = "退款时间", sortNum = "14", type = InputType.date, grid = true)
    @Column(name = "refund_time")
    private LocalDateTime refundTime;

    @Comment("退款方式")
    @FormField(title = "退款方式", sortNum = "15", grid = true, type = InputType.select)
    @Column(name = "refund_method")
    private Integer refundMethod;

    @Comment("第三方退款单号")
    @FormField(title = "第三方退款单号", sortNum = "16", grid = true)
    @Column(name = "third_refund_no", length = 100)
    private String thirdRefundNo;

    @Comment("退款凭证")
    @FormField(title = "退款凭证", sortNum = "17", type = InputType.image)
    @Column(name = "refund_proof", length = 500)
    private String refundProof;
} 